#ifndef __COARSELOCATING__HPP__
#define __COARSELOCATING__HPP__

#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <string>
#include <iostream>
#include <vector>
#include "System.h"

using namespace cv;
using namespace std;

namespace xyVision {

struct cameraParams {
    Matx33f cameraMatrix;
    Matx14f distortCoeff;
    Size imageSize;
    Size newSize;
    Matx33f newCameraMatrix;
    Mat map1, map2;
};
struct SLAMInfo {
    string voc_file;
    string settings_file;
    string map_file;
    double ts;
    double ts_interval;
};

class coarseLocating{
public:
    coarseLocating(const string& configName);

    void setParameters(const string& configName);

    void getCurrentGPS(const Mat& image);

    bool isDetected;

    cv::Mat oriImg, rectifiedImg;

    cameraParams cameraInfo;

    ORB_SLAM2::System* SLAM;

    vector<double> gps;
private:
    float scale;
    SLAMInfo slamInfo;

    void adjustImg(const Mat& input, Mat& output);
    void getGPS();
};


} // end xyVision
#endif
